package com.zw.pdm.module.designtask.controller;

import com.zw.pdm.base.BaseController;
import com.zw.pdm.common.JsonResult;
import com.zw.pdm.module.designtask.model.DsnProcessModel;
import com.zw.pdm.module.designtask.service.DsnIssueService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @Description: 设计图纸下发状态
 * 权限：
 * dsn:proIssue:view 查看
 * dsn:proIssue:edit 编辑
 * @Author: China.wsg
 * @Date: 2020/8/14 14:47
 */
@Controller
@RequestMapping("/designTask/dsnIssue")
@SuppressWarnings("all")
public class DsnIssueController extends BaseController {

    @Autowired
    private DsnIssueService dsnIssueService;

    /**
     * 设计项目页面
     *
     * @return
     */
    @GetMapping("/page")
    @RequiresPermissions({"dsn:proIssue:view"})
    public String page() {
        return "designtask/list/dsnIssuePage";
    }

    /**
     * 设计项目列表（数据）
     */
    @ResponseBody
    @PostMapping("/list")
    @RequiresPermissions({"dsn:proIssue:view"})
    public JsonResult issueList(DsnProcessModel dsnProcessModel) {
        startPage();
        List<DsnProcessModel> list = dsnIssueService.findProjectIssueByQuery(dsnProcessModel);
        return jsonResult(list);
    }

    /**
     * 图纸下发确认状态修改
     */
    @ResponseBody
    @PostMapping("/commit")
    @RequiresPermissions({"dsn:proIssue:edit"})
    public JsonResult editIssueStatus(String proCode,Integer dsnIssueStatus) {
        return jsonResult(dsnIssueService.editIssueStatus(proCode,dsnIssueStatus));
    }



}
